Allows Mistral byok to be used for Codestral#4000
Conversation
|
|
||
| const byokProviderKey = fimProvider === 'mistral' ? 'codestral' : 'inception'; | ||
| const byokProviderKeys: UserByokProviderId[] = | ||
| fimProvider === 'mistral' ? ['codestral', 'mistral'] : ['inception']; |
There was a problem hiding this comment.
WARNING: BYOK key priority not honoured — DB orderBy(created_at) overrides the ['codestral', 'mistral'] intent
getBYOKforUser/getBYOKforOrganization query with inArray(byok_api_keys.provider_id, providerIds) and orderBy(byok_api_keys.created_at). SQL's IN (…) clause does not preserve the input array order, so when a user has both a codestral key and a mistral key the DB returns them oldest-first.
userByok?.at(0) (line 237) then picks the oldest key regardless of which provider it is. If the mistral key was created before the codestral key, the codestral key is silently ignored and the user's Mistral La Plateforme key is used with api.mistral.ai — the correct endpoint for that key type, but the codestral key preference is lost.
To honour the priority ordering, consider re-sorting the returned entries client-side by their position in byokProviderKeys before calling .at(0):
const sorted = userByok?.slice().sort(
(a, b) => byokProviderKeys.indexOf(a.providerId) - byokProviderKeys.indexOf(b.providerId)
);
const userByokEntry = sorted?.at(0);Reply with @kilocode-bot fix it to have Kilo Code address this issue.
Code Review SummaryStatus: No Issues Found | Recommendation: Merge Executive SummaryAll previously flagged issues have been resolved; the FIM route now correctly honours the Previously Resolved Issues
Files Reviewed (4 files)
Fix these issues in Kilo Cloud Previous Review Summaries (2 snapshots, latest commit 9ab1e0d)Current summary above is authoritative. Previous snapshots are kept for context only. Previous review (commit 9ab1e0d)Status: 1 Issue Found | Recommendation: Address before merge Executive SummaryThe Overview
Issue Details (click to expand)WARNING
Previously Resolved Issues
Files Reviewed (4 files)
Fix these issues in Kilo Cloud Previous review (commit 34536a8)Status: 2 Issues Found | Recommendation: Address before merge Executive SummaryThe Overview
Issue Details (click to expand)WARNING
SUGGESTION
Files Reviewed (4 files)
Reviewed by claude-4.6-sonnet-20260217 · 278,093 tokens Review guidance: REVIEW.md from base branch |
No description provided.